<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Taco Cloud</title>
    <link rel="stylesheet" th:href="@{/styles.css}"/>
</head>

<body>

<form method="POST" th:action="@{/orders}" th:object="${order}">
    <h1>Order your taco creations!</h1>

    <img th:src="@{/images/TacoCloud.png}"/>
    <a id="another" th:href="@{/design}">Design another taco</a><br/>

    <div th:if="${#fields.hasErrors()}">
        <span class="validationError">
        Please correct the problems below and resubmit.
        </span>
    </div>

    <h3>Deliver my taco masterpieces to...</h3>
    <label for="name">Name: </label>
    <input th:field="*{name}" type="text"/>
    <span class="validationError"
          th:errors="*{name}"
          th:if="${#fields.hasErrors('name')}">Name Error</span>
    <br/>

    <label for="street">Street address: </label>
    <input th:field="*{street}" type="text"/>
    <span class="validationError"
          th:errors="*{street}"
          th:if="${#fields.hasErrors('street')}">Street Error</span>
    <br/>

    <label for="city">City: </label>
    <input th:field="*{city}" type="text"/>
    <span class="validationError"
          th:errors="*{city}"
          th:if="${#fields.hasErrors('city')}">City Error</span>
    <br/>

    <label for="state">State: </label>
    <input th:field="*{state}" type="text"/>
    <span class="validationError"
          th:errors="*{state}"
          th:if="${#fields.hasErrors('state')}">State Error</span>
    <br/>

    <label for="zip">Zip code: </label>
    <input th:field="*{zip}" type="text"/>
    <span class="validationError"
          th:errors="*{zip}"
          th:if="${#fields.hasErrors('zip')}">Zip Error</span>
    <br/>

    <h3>Here's how I'll pay...</h3>
    <label for="ccNumber">Credit Card #: </label>
    <input th:field="*{ccNumber}" type="text"/>
    <span class="validationError"
          th:errors="*{ccNumber}"
          th:if="${#fields.hasErrors('ccNumber')}">CC Num Error</span>
    <br/>

    <label for="ccExpiration">Expiration: </label>
    <input th:field="*{ccExpiration}" type="text"/>
    <span class="validationError"
          th:errors="*{ccExpiration}"
          th:if="${#fields.hasErrors('ccExpiration')}">CC Num Error</span>
    <br/>

    <label for="ccCVV">CVV: </label>
    <input th:field="*{ccCVV}" type="text"/>
    <span class="validationError"
          th:errors="*{ccCVV}"
          th:if="${#fields.hasErrors('ccCVV')}">CC Num Error</span>
    <br/>

    <input type="submit" value="Submit order"/>
</form>

</body>
</html>
